﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GalaSoft.MvvmLight;
using System.Collections.ObjectModel;
using SWCInvoice.Model;
using SWCInvoice.Servicelayer;
using Cyotek.GhostScript;

namespace SWCInvoice.ViewModel {
    public class PreviewSettingsViewModel : ViewModelBase {

        #region Fields

        /// <summary>
        /// The list of preview image formats
        /// </summary>
        ObservableCollection<ImageFormatWrapper> _previewImageFormats;

        /// <summary>
        /// The list of preview image dpi
        /// </summary>
        ObservableCollection<int> _previewImageDPIs;

        /// <summary>
        /// The list of preview image antialias modes
        /// </summary>
        ObservableCollection<AntiAliasModeWrapper> _previewImageAntiAliasModes;

        /// <summary>
        /// Current preview image formats
        /// </summary>
        ImageFormatWrapper _currentPreviewImageFormat;

        /// <summary>
        /// Current preview image dpi
        /// </summary>
        int _currentPreviewImageDPI;

        /// <summary>
        /// Current preview image antialias modes
        /// </summary>
        AntiAliasModeWrapper _currentPreviewImageAntiAliasMode;
        #endregion

        #region Properties

        /// <summary>
        /// The list of preview image formats
        /// </summary>
        public ObservableCollection<ImageFormatWrapper> PreviewImageFormats {
            get {
                return _previewImageFormats == null ? _previewImageFormats = new ObservableCollection<ImageFormatWrapper>() : _previewImageFormats;
            }
            set {
                if (_previewImageFormats == value)
                    return;
                _previewImageFormats = value;
                RaisePropertyChanged("PreviewImageFormats");
            }
        }

        /// <summary>
        /// The list of preview image dpi
        /// </summary>
        public ObservableCollection<int> PreviewImageDPIs {
            get {
                return _previewImageDPIs == null ? _previewImageDPIs = new ObservableCollection<int>() : _previewImageDPIs;
            }
            set {
                if (_previewImageDPIs == value)
                    return;
                _previewImageDPIs = value;
                RaisePropertyChanged("PreviewImageDPIs");
            }
        }

        /// <summary>
        /// The list of preview image antialias modes
        /// </summary>
        public ObservableCollection<AntiAliasModeWrapper> PreviewImageAntiAliasModes {
            get {
                return _previewImageAntiAliasModes == null ? _previewImageAntiAliasModes = new ObservableCollection<AntiAliasModeWrapper>() : _previewImageAntiAliasModes;
            }
            set {
                if (_previewImageAntiAliasModes == value)
                    return;
                _previewImageAntiAliasModes = value;
                RaisePropertyChanged("PreviewImageAntiAliasModes");
            }
        }

        /// <summary>
        /// Gets or sets current preview image formats
        /// </summary>
        public ImageFormatWrapper CurrentPreviewImageFormat {
            get { return _currentPreviewImageFormat; }
            set {
                if (_currentPreviewImageFormat == value) return;
                _currentPreviewImageFormat = value;
                RaisePropertyChanged("CurrentPreviewImageFormat");
            }
        }

        /// <summary>
        /// Gets or sets current preview image dpi
        /// </summary>
        public int CurrentPreviewImageDPI {
            get { return _currentPreviewImageDPI; }
            set {
                if (_currentPreviewImageDPI == value) return;
                _currentPreviewImageDPI = value;
                RaisePropertyChanged("CurrentPreviewImageDPI");
            }
        }

        /// <summary>
        /// Gets or sets current preview image antialias modes
        /// </summary>
        public AntiAliasModeWrapper CurrentPreviewImageAntiAliasMode {
            get { return _currentPreviewImageAntiAliasMode; }
            set {
                if (_currentPreviewImageAntiAliasMode == value) return;
                _currentPreviewImageAntiAliasMode = value;
                RaisePropertyChanged("CurrentPreviewImageAntiAliasMode");
            }
        }
        
        #endregion
    }
}
